package com.yunshang.shoppingmall.ShopTask.Task.Hsys;

import com.alibaba.fastjson.JSON;

import com.yunshang.shoppingmall.common.HttpRequest;
import com.yunshang.shoppingmall.controller.User.JsonRootBean;
import com.yunshang.shoppingmall.entity.Config;
import com.yunshang.shoppingmall.entity.User;

import java.util.List;

public class UserData {

    public static List<User> userList;

    public static List<User> getUserList(Config config)
    {
        if(userList!=null)
        {
            return userList;
        }
        else
        {
            String json = HttpRequest.sendGet(config.getUserUrl() +"/API/user/UserList","key="+config.getUserKey()+"&page=0&limit=10");
            JsonRootBean jsonRootBean =  JSON.parseObject(json, JsonRootBean.class);
            userList = jsonRootBean.getData();
            return userList;
        }
    }

}
